﻿/* ── Palette (đồng bộ NavMenu) ──────────────────────────────── */
:root {
    --n900: #17295ccb;
    --n800: #1e40afde;
    --n700: #1d4ed8;
    --n600: #2563eb;
    --n400: #3b82f6;
    --n300: #93c5fd;
    --n200: #76c4f1;
    --n100: #dbeafe;
    --n50: #eff6ff;
    --n-text: #00276b;
    --n-muted: #053d8b;
    --n-faint: #516e96;
}

/* ══════════════════════════════════════════════════════════════
   DARK (NAVY) PALETTE — kích hoạt khi body.dark
   ══════════════════════════════════════════════════════════════ */
body.dark {
    --n900: #e0eeff;
    --n800: #93c5fd;
    --n700: #2d30fa;
    --n600: #3b82f6;
    --n400: #2563eb;
    --n300: #1d4ed8;
    --n200: #092a97e5;
    --n100: #233f4fea;
    --n50: #0a122ac6;
    --n-text: #464b52;
    --n-muted: #fdbd93;
    --n-faint: #3b6cb5;
    background-color: #19243fb4;
    color: var(--n-text);
}

/* ── Wrapper ─────────────────────────────────────────────────── */
.dashboard-home {
    overflow-x: hidden;
}

/* ══════════════════════════════════════════════════════════════
   HEADER
   ══════════════════════════════════════════════════════════════ */
.db-header {
    margin-top: 0px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 16px;
    background: var(--n600);
    border-bottom: 2px solid var(--n400);
    margin-bottom: 16px;
    border-radius: 14px;
    transition: background 0.25s, border-color 0.25s;
}

body.dark .db-header {
    background: #1c293f;
    border-bottom-color: #fab47a;
}

.db-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #fcfcfc;
    transition: color 0.25s;
}

.db-sub {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.75);
    margin-top: 3px;
    transition: color 0.25s;
}

body.dark .db-sub {
    color: var(--n-muted);
}

.time-chip {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.85);
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    padding: 5px 14px;
    border-radius: 99px;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
    font-weight: 500;
    transition: background 0.25s, border-color 0.25s, color 0.25s;
}

body.dark .time-chip {
    color: var(--n-muted);
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
}

/* ══════════════════════════════════════════════════════════════
   ICON COLORS
   ══════════════════════════════════════════════════════════════ */
.si-purple {
    background: #EEEDFE;
    color: #534AB7;
}

.si-blue {
    background: var(--n100);
    color: var(--n700);
}

.si-green {
    background: #EAF3DE;
    color: #3B6D11;
}

.si-amber {
    background: #FAEEDA;
    color: #854F0B;
}

.si-teal {
    background: #E1F5EE;
    color: #0F6E56;
}

.si-coral {
    background: #FAECE7;
    color: #993C1D;
}

body.dark .si-purple {
    background: #2d2a5e;
    color: #a5b4fc;
}

body.dark .si-blue {
    background: #1e3a5f;
    color: #93c5fd;
}

body.dark .si-green {
    background: #14381f;
    color: #86efac;
}

body.dark .si-amber {
    background: #3a2008;
    color: #fcd34d;
}

body.dark .si-teal {
    background: #0f2e26;
    color: #5eead4;
}

body.dark .si-coral {
    background: #3a1a10;
    color: #fca5a5;
}

/* ══════════════════════════════════════════════════════════════
   STATS GRID
   ══════════════════════════════════════════════════════════════ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 14px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 12px;
    
    background: #ffffff;
    border: 1px solid var(--n100);
    border-radius: 14px;
    transition: border-color .15s, transform .15s, background .25s;
}

    .stat-card:hover {
        border-color: var(--n400);
        transform: translateY(-2px);
    }

body.dark .stat-card {
    background: #1e293b;
    border-color: #334155;
}

    body.dark .stat-card:hover {
        border-color: var(--n400);
        background: #263348;
    }

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--n-text);
    line-height: 1;
    transition: color 0.25s;
}

.stat-label {
    font-size: 0.68rem;
    color: var(--n-muted);
    margin-top: 3px;
    font-weight: 600;
    transition: color 0.25s;
}

.stat-sub {
    font-size: 0.62rem;
    margin-top: 3px;
}

    .stat-sub.ok {
        color: #3B6D11;
    }

    .stat-sub.warn {
        color: #854F0B;
    }

    .stat-sub.bad {
        color: #a32d2d7e;
    }

body.dark .stat-sub.ok {
    color: #86efac;
}

body.dark .stat-sub.warn {
    color: #fcd34d;
}

body.dark .stat-sub.bad {
    color: #fca5a5;
}

/* ══════════════════════════════════════════════════════════════
   SHARED CARD
   ══════════════════════════════════════════════════════════════ */
.d-card {
    background: #ffffff;
    border: 1px solid var(--n100);
    border-radius: 14px;
    padding: 16px 18px;
    transition: background 0.25s, border-color 0.25s;
}

body.dark .d-card {
    background: #1e293b;
    border-color: #334155;
}

.d-card__head {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.67rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--n-muted);
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--n100);
    transition: color 0.25s, border-color 0.25s;
}

    .d-card__head i {
        font-size: 0.82rem;
    }

/* ══════════════════════════════════════════════════════════════
   MID GRID  (TKB | CẢNH BÁO | TIẾN ĐỘ)
   ══════════════════════════════════════════════════════════════ */
.mid-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 12px;
    
    margin-bottom: 14px;
}

/* ── TKB TABLE ── */
.tkb-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
}

.tkb-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.6rem;
    border: 1px solid var(--n100);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.25s;
}

    .tkb-table thead th {
        padding: 8px 5px;
        background: var(--n50);
        color: var(--n-muted);
        font-size: 0.6rem;
        font-weight: 500;
        text-align: center;
        border-bottom: 1px solid var(--n100);
        transition: background 0.25s, color 0.25s, border-color 0.25s;
    }

    .tkb-table tbody td {
        padding: 7px 5px;
        text-align: center;
        vertical-align: middle;
        border-bottom: 1px solid var(--n100);
        border-right: 1px solid var(--n100);
        transition: background 0.25s, border-color 0.25s;
    }

        .tkb-table tbody td:last-child {
            border-right: none;
        }

    .tkb-table tbody tr:last-child td {
        border-bottom: none;
    }




.tiet-col-head {
    width: 33px;
}

.tiet-col {
    width: 33px;
    background: #fafcff;
    color: var(--n-muted);
    font-size: 0.6rem;
    font-weight: 500;
    transition: background 0.25s, color 0.25s;
}

body.dark .tiet-col {
    background: #172033;
}

.tiet-active-row td {
    background: #E1F5EE !important;
}

body.dark .tiet-active-row td {
    background: #0f2e26 !important;
}

.tiet-num-active {
    color: #0F6E56 !important;
    font-weight: 800 !important;
}

.mon-hoc {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 5px;
    background: var(--n50);
    color: var(--n700);
    font-size: 0.6rem;
    font-weight: 600;
    transition: background 0.25s, color 0.25s;
}

.giao-vien {
    margin-top: 2px;
    font-size: 0.62rem;
    color: #64748b;
}

body.dark .giao-vien {
    color: #dae5f5;
}

body.dark .mon-hoc {
    background: none;

}

.tkb-footer {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.65rem;
    color: #64748b;
    margin-top: 8px;
}

.tkb-legend-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 3px;
    background: #1D9E75;
    flex-shrink: 0;
}

.tkb-link {
    margin-left: auto;
    font-size: 0.68rem;
    color: var(--n-muted);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.25s;
}

    .tkb-link:hover {
        text-decoration: underline;
    }

.empty-state {
    padding: 28px;
    text-align: center;
    color: #94a3b8;
    font-size: 0.82rem;
}

/* ── ALERT ITEMS ── */
.alert-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 10px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 500;
    margin-bottom: 6px;
}

    .alert-item:last-child {
        margin-bottom: 0;
    }

    .alert-item i {
        font-size: 0.88rem;
        flex-shrink: 0;
    }

    .alert-item.danger {
        background: #fef2f2;
        color: #991b1b;
        border: 1px solid #fecaca;
    }

    .alert-item.warning {
        background: #fffbeb;
        color: #92400e;
        border: 1px solid #fde68a;
    }

    .alert-item.success {
        background: #f0fdf4;
        color: #166534;
        border: 1px solid #bbf7d0;
    }

body.dark .alert-item.danger {
    background: #2d1515af;
    color: #fca5a5;
    border-color: #7f1d1d;
}

body.dark .alert-item.warning {
    background: #2d2008;
    color: #fcd34d;
    border-color: #78350f;
}

body.dark .alert-item.success {
    background: #0f2e1a;
    color: #86efac;
    border-color: #14532d;
}

/* ── PROGRESS ── */
.prog-list {
    display: flex;
    flex-direction: column;
    gap: 11px;
}

.prog-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3px;
}

.prog-name {
    font-size: 0.74rem;
    color: var(--n-muted);
}

.prog-pct {
    font-size: 0.74rem;
    font-weight: 700;
}

    .prog-pct.ok {
        color: #3B6D11;
    }

    .prog-pct.warn {
        color: #854F0B;
    }

    .prog-pct.bad {
        color: #A32D2D;
    }

body.dark .prog-pct.ok {
    color: #86efac;
}

body.dark .prog-pct.warn {
    color: #fcd34d;
}

body.dark .prog-pct.bad {
    color: #fca5a5;
}

.prog-track {
    height: 4px;
    background: var(--n100);
    border-radius: 99px;
    overflow: hidden;
    transition: background 0.25s;
}

.prog-fill {
    height: 100%;
    border-radius: 99px;
    transition: width .5s ease;
}

/* ══════════════════════════════════════════════════════════════
   SECTION LABEL & APP GRID
   ══════════════════════════════════════════════════════════════ */
.section-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--n700);
    margin: 12px 12px 6px;
    user-select: none;
    transition: color 0.25s;
}

    .section-label::after {
        content: "";
        flex: 1;
        height: 1px;
        background: linear-gradient(to right, var(--n400), transparent);
        transition: background 0.25s;
    }

body.dark .section-label::after {
    background: linear-gradient( to right, #fda971, transparent );
    color: #f89669 !important;
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.app-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px;
    background: #fff;
    border: 1px solid var(--n100);
    border-radius: 13px;
    transition: border-color .15s, transform .15s, background .25s;
}

    .app-card:hover {
        border-color: var(--n400);
        transform: translateY(-2px);
    }

body.dark .app-card {
    background: #1e293b;
    border-color: #334155;
}

    body.dark .app-card:hover {
        border-color: var(--n400);
        background: #263348;
    }

.app-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    margin-bottom: 2px;
}

.app-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--n-text);
    transition: color 0.25s;
}

.app-desc {
    font-size: 0.68rem;
    color: #314d78;
    line-height: 1.45;
}

body.dark .app-desc {
    color: #b8cce7;
}

.app-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.64rem;
    font-weight: 600;
    padding: 2px 9px;
    border-radius: 99px;
    width: fit-content;
}

    .app-badge i {
        font-size: 0.66rem;
    }

.badge-ok {
    background: #EAF3DE;
    color: #27500A;
}

.badge-warn {
    background: #FAEEDA;
    color: #633806;
}

.badge-bad {
    background: #FCEBEB;
    color: #791F1F;
}

body.dark .badge-ok {
    background: #14381f;
    color: #86efac;
}

body.dark .badge-warn {
    background: #3a2008;
    color: #fcd34d;
}

body.dark .badge-bad {
    background: #441313b9;
    color: #f8cfcf;
}

.app-link {
    font-size: 0.68rem;
    color: var(--n-muted);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.25s;
}

    .app-link:hover {
        text-decoration: underline;
    }

.app-soon {
    font-size: 0.64rem;
    color: #94a3b8;
}

body.dark .app-soon {
    color: #64748b;
}

/* ===== FORCE DARK TEXT ===== */

body.dark .d-card,
body.dark .app-card,
body.dark .stat-card,
body.dark .tkb-table,
body.dark .tkb-table th,
body.dark .tkb-table td {
    color: #f6f1f1 !important;
}

body.dark .app-name,
body.dark .stat-value,
body.dark .d-card__head,
body.dark .mon-hoc,
body.dark .prog-name {
    color: #ffffff !important;
}

body.dark .app-desc,
body.dark .stat-label,
body.dark .giao-vien,
body.dark .tkb-link {
    color: #94a3b8 !important;
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 1200px) {
    .mid-grid {
        grid-template-columns: 1fr 1fr;
    }

        .mid-grid .d-card:last-child {
            grid-column: 1 / -1;
        }

    .app-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .mid-grid {
        grid-template-columns: 1fr;
    }

        .mid-grid .d-card:last-child {
            grid-column: auto;
        }
}

@media (max-width: 768px) {
    .db-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .stats-grid,
    .mid-grid,
    .app-grid {
        padding: 0 12px;
    }

    .section-label {
        padding: 0 12px;
    }

    .stat-card {
        padding: 12px 13px;
    }

    .stat-value {
        font-size: 1.35rem;
    }

    .d-card {
        padding: 13px 14px;
        border-radius: 12px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        gap: 6px;
    }

    .stat-card {
        padding: 10px;
        gap: 10px;
    }

    .stat-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .stat-value {
        font-size: 1.2rem;
    }

    .stat-label {
        font-size: 0.65rem;
    }

    .stat-sub {
        font-size: 0.6rem;
    }

    .app-grid {
        grid-template-columns: 1fr;
    }
}
